#include "displayframe.h"
#include <QFont>

DisplayFrame::DisplayFrame(QWidget *parent)
    : QFrame(parent) , topLabel(new QLabel("10", this)), bottomLabel(new QLabel("坚持天数", this)){
    layout = new QVBoxLayout(this);
    layout->addWidget(topLabel);
    layout->addWidget(bottomLabel);

    this->setFrameShape(QFrame::Box);
    this->setLineWidth(0);
    this->setStyleSheet("QFrame { background-color: lightgray; }"); 

    QFont font = topLabel->font();
    font.setPointSize(24);
    topLabel->setFont(font);
    topLabel->setAlignment(Qt::AlignCenter);

    font.setPointSize(10);
    bottomLabel->setFont(font);
    bottomLabel->setAlignment(Qt::AlignCenter);
}

void DisplayFrame::setTopText(const QString &text) {
    topLabel->setText(text);
}

void DisplayFrame::setBottomText(const QString &text) {
    bottomLabel->setText(text);
}

void DisplayFrame::setBackgroundColor(const QString &color) {
    this->setStyleSheet(QString("background-color: %1;").arg(color));
}